<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<hr />
<div class="row">
	<div class="col-md-6" style="padding-bottom: 20px;">
		参数集合
		<div class="btn-group btn-group-justified btn-group-xs" role="group"
			style="margin-bottom: 8px;" aria-label="Justified button group">
			<a class="btn btn-default" role="button" onclick="openSearchBox()"><i
				class="glyphicon glyphicon-search"></i>&nbsp;搜索</a> <a
				class="btn btn-default" role="button" onclick="loadParas()"> <i
				class="glyphicon glyphicon-eye-open"></i>&nbsp;显示参数
			</a> <a class="btn btn-default" role="button" onclick="loadTempMarks()"><i
				class="glyphicon glyphicon-bookmark"></i>&nbsp;显示模板</a>
		</div>
		<pre id="editor" style="height: 500px; border: 0px;">123</pre>
	</div>
	<div class="col-md-6" style="padding-bottom: 20px;">
		调试信息 <br /> <br />
		<pre id="debugEt" style="height: 500px; border: 0px;">debug</pre>
	</div>
</div>
<script type="text/javascript">
	var cbtg_editor;
	$(function() {
		cbtg_editor = ace.edit("editor", {
			theme : "ace/theme/tomorrow_night_eighties",
			mode : "ace/mode/html",
			wrap : true,
			autoScrollEditorIntoView : true
		});
		cbtg_editor.setTheme("ace/theme/twilight");
		cbtg_editor.session.setMode("ace/mode/json");
		cbtg_editor.setValue("参数展示区");
		cbtg_editor.setReadOnly(true);
	});

	//加载参数（变量模型）
	function loadParas() {
		$.post('prorun/loadActiveAttrs.do', {
			'activeid' : '${active.id}'
		}, function(flag) {
			if (flag.STATE == 0) {
				//成功
				cbtg_editor.setValue(flag.json);
				cbtg_editor.session.setMode("ace/mode/json");
			} else {
				alert(flag.MESSAGE);
			}
		}, 'json');
	}

	//加载参数（模板模型）
	function loadTempMarks() {
		$.post('prorun/loadMarkAttrs.do', {
			'activeid' : '${active.id}'
		}, function(flag) {
			if (flag.STATE == 0) {
				//成功
				cbtg_editor.setValue(flag.json);
				cbtg_editor.session.setMode("ace/mode/properties");
			} else {
				alert(flag.MESSAGE);
			}
		}, 'json');
	}

	function openSearchBox() {
		cbtg_editor.execCommand('find');
	}
</script>
<script>
	var cbtg_debugs;
	$(function() {
		cbtg_editor = ace.edit("editor", {
			theme : "ace/theme/tomorrow_night_eighties",
			mode : "ace/mode/html",
			wrap : true,
			autoScrollEditorIntoView : true
		});
		cbtg_editor.setTheme("ace/theme/twilight");
		cbtg_editor.session.setMode("ace/mode/json");
		cbtg_editor.setValue("参数展示区");
		cbtg_editor.setReadOnly(true);

		cbtg_debugs = ace.edit("debugEt", {
			theme : "ace/theme/tomorrow_night_eighties",
			mode : "ace/mode/html",
			wrap : true,
			autoScrollEditorIntoView : true
		});
		cbtg_debugs.setTheme("ace/theme/twilight");
		cbtg_debugs.session.setMode("ace/mode/json");
		cbtg_debugs.setValue("{\"title\":\"调试信息展示区\"}");
		cbtg_debugs.setReadOnly(true);
	});
	//加载调试信息
	function loadDebugInfo() {
		$.post('prorun/loadActiveDebugInfo.do', {
			'activeid' : '${active.id}'
		}, function(flag) {
			if (flag.STATE == 0) {
				//成功
				cbtg_debugs.setValue(flag.json);
				cbtg_debugs.session.setMode("ace/mode/json");
			} else {
				alert(flag.MESSAGE);
			}
		}, 'json');
	}
</script>


